<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>类继承</title>
</head>
<body>
    <script>
        class photo {
            //构造方法
            constructor(brand,price){
                this.brand = brand;
                this.price = price;
            }

            call(){
                console.log("我可以打电话");
            }
        }

        class SmartPhone extends photo{
            //构造方法
            constructor(brand,price,color,size){
                super(brand,price);
                this.color = color;
                this.size = size;
            }

            photo(){
                console.log("照相");
            }
            playGame(){
                console.log("玩游戏");
            }
            call(){
                //不能使用super();方法
                console.log("我可以视频通话");
            }
        }

        const xiaomi = new SmartPhone("小米","5400","白色","5.5inch");
        xiaomi.call();
        xiaomi.playGame();
        xiaomi.photo();
    </script>
</body>
</html>